const mongoose = require('mongoose')
const Schema = mongoose.Schema//获取数据库对象中的映射表方法

const TaskSchema = new Schema(//在映射表示例中写入需要映射的数据
    {
        title: {
            type: String,
            require: true
          },
          place: {
            type: String
          },
          price: {
            type: Number
          },
          select: {
            type: Array
          },
          content: {
            type: String
          },
          currentDate: {
            type: String
          },
          hours: {
            type: String
          },
          userId:{
            type:String
          },
          applicants:{//报名者ID
            type:String
          },
          status:{
            type:Number
          },
          userinfo:{
            type:Object
          }
        
},
{
collection:'task',//需要映射的表名
versionKey:false//关闭版本密钥
}
)

 const task_model = mongoose.model('task',TaskSchema)//让schema生效
 module.exports =  task_model